package 类与对象;


import 类与对象.访问修饰符.public001;

public class demo {
    public static void main(String[] args) {
        demo demo = new demo();
        int fibonacci = demo.fibonacci(7);
        System.out.println(fibonacci);
        int peach = demo.peach(9);
        System.out.println(peach);

        public001 public001 = new public001();
        public001.test001();
    }
    //求斐波拉契数
    public int fibonacci(int n){
        if (n >= 1){
            if(n == 1 || n == 2){
                return 1;
            }
            else {
                return fibonacci(n - 1) + fibonacci(n - 2);
            }
        }
        else {
            return -1;
        }
    }

    //猴子偷桃
    public int peach(int day){
        if(day == 10){
            return 1;
        }else if (day >= 1 && day <= 9){
            return (peach(day + 1) + 1) * 2;
        }else {
            return -1;
        }
    }
}
